<?php
/**
 * 线索模型
 * @Author: wjf
 * @Date: 2022-12-01 09:16:59
 */

namespace app\crm\model\clue;

use think\Model;

class Cluelist extends Model
{
     /**
     * 设置当前模型对应的完整数据表名称 
     * @Author: wjf
     * @Date: 2022-11-26 15:03:14
    */ 
    protected $table = 'crm_client';
    /**
     * 自动写入时间戳 
     * @Author: wjf
     * @Date: 2022-11-26 15:25:06
    */  
    protected $autoWriteTimestamp = true;
     /**
      * auto属性自动完成包含新增和更新操作
      * @Author: wjf
      * @Date: 2022-12-01 09:57:42
      */    
    protected $auto = ['status' => 3, 'super_id' => 1,'classify' => 2];

    /**
     * 插入转为时间戳
     * @Author: wjf
     * @Date: 2022-11-30 11:43:08
     */    
    public function setFollowTimeAttr($value)
    {
        return strtotime($value);
    }

    /**
     * 遍历转为时间
     * @Author: wjf
     * @Date: 2022-11-30 11:43:34
     */   
    public function getFollowTimeAttr($value)
    {
        return date('Y-m-d H:i:s',$value);
    } 

    public function getGetTimeAttr($value)
    {
        return date('Y-m-d H:i:s',$value);
    }

    /**
     * 状态
     * @Author: wjf
     * @Date: 2022-11-30 11:51:29
     */    
    public function getStatusAttr($value,$data)
    {
        $stutas = [0 => '未成交', 1 => '已成交', 2 => '已转客户', 3 => '无效线索'];
        return $stutas[$data['status']];
    }
}
